/**
 * 告警指标
 */
import request from '@/utils/request';

// 统计指标列表数据查询
export function queryAdvancedIndicatorsList(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmIndicators/customAlarmIndicators',
		method: 'post',
		data: query,
	});
}

// 根据id查询指标(基础、自定义)
export function queryIndicatorById(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmIndicators/' + id,
		method: 'get',
	});
}

// 通过告警对象查询指标编码
export function queryCodeList(objValue: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmIndicators/queryCodeList/' + objValue,
		method: 'get',
	});
}

//新增统计指标
export function addAdvancedIndicator(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmIndicators/customAlarmIndicators/save',
		method: 'post',
		data: query,
	});
}

//修改自定义指标
export function editAdvancedIndicator(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmIndicators/customAlarmIndicators',
		method: 'put',
		data: query,
	});
}

//根据id批量删除指标
export function deleteIndicatorsByIds(ids: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmIndicators/delete/' + ids,
		method: 'delete',
	});
}

//是否禁用基础指标
export function editBaseIndicatorsEnable(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmIndicators/baseAlarmIndicators/editIndicatorsEnable',
		method: 'post',
		data: query,
	});
}

//是否禁用自定义指标
export function editCustomIndicatorsEnable(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmIndicators/customAlarmIndicators/editIndicatorsEnable',
		method: 'post',
		data: query,
	});
}

//根据指标id查询告警
export function queryAlarmByIndicatorId(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarm/queryAlarmByIndicatorId/' + id,
		method: 'get',
	});
}

//校验表达式
export function checkExpression(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/business-monitor/alarm/business/checkExpression',
		method: 'post',
		data: query,
	});
}

//查询基础指标列表
export function queryBaseIndicatorsList(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmIndicators/baseAlarmIndicators',
		method: 'post',
		data: query,
	});
}

//修改基础指标
export function editBaseIndicator(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmIndicators/baseAlarmIndicators',
		method: 'put',
		data: query,
		// noSliceEmpty: true,
	});
}
